=head1 BASE INFORMATION

=head2 Filename

ApiDoc.pm

=head2 Path

/lib/Controller/Default/

=head2 Notes

=head2 ToDo's

=head2 Revision

=over 4

=item *

$HeadURL: http://catwork.googlecode.com/svn/trunk/lib/catwork/Controller/Default/ApiDoc.pm $

=item * 

$Id: ApiDoc.pm 2 2011-03-20 16:14:09Z hg.winkler.77 $

=back

=head2 Header Source Code

=cut

package catwork::Controller::Default::ApiDoc;
use Moose;
use namespace::autoclean;

my $tool_path = "";
my $title     = "";

BEGIN {extends 'Catalyst::Controller'; }

=head1 NAME

catwork::Controller::Default::ApiDoc - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS

=cut


=head2 index

=head3 source code

=cut

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;

    $c->response->body('Matched catwork::Controller::Default::ApiDoc in Default::ApiDoc.');
}

=head2 apidoc

is called on every apidoc action

=head3 source code

=cut

sub apidoc :Chained('/') :PathPart('apidoc') :CaptureArgs(0) {
    
    my ($self, $c) = @_;
    $tool_path = "catwOrk -> ApiDoc";
    $title = "API Doc";

}

=head2 load

this function is the initial loading funktion for the apidoc

=head3 stash

    $c->stash( 
        TITLE      => $title,
        TOOLPATH   => $tool_path,
        template   => 'apidoc/apidoc.tt2',
    );

=head3 source code

=cut

sub load :Chained('apidoc') :PathPart('') :Args(0) {
    
    my ($self, $c) = @_;
    $c->stash( 
        TITLE      => $title,
        TOOLPATH   => $tool_path,
        template   => 'apidoc/apidoc.tt2',
    );
}

=head2 apidoc_list

this function returns a json structure representing our lib folder to use it
in jstree

=head3 stash

    $c->stash(
        apidoc_list_json => $apidoc_list_json,
        ajax => 1,
        template => 'apidoc/ajax_get_apidoc_list.tt2'
    );

=head3 source code

=cut

sub apidoc_list :Chained('apidoc') :PathPart('get/apidoc_list') :Args(0) {
    
    my ($self, $c) = @_;

    my $apidoc_list = $c->model('APIDoc')->get_apidoc_list($c);
    my $apidoc_list_json = $c->model('APIDoc')->generate_json($c, $apidoc_list);
    
    $c->stash(
        apidoc_list_json => $apidoc_list_json,
        ajax => 1,
        template => 'apidoc/get_apidoc_list.tt2'
    );

}

=head1 AUTHOR

Hans-Georg Winkler,,,

=head1 LICENSE

This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

__PACKAGE__->meta->make_immutable;

